const HtmlWebpackPlugin = require("html-webpack-plugin");
const path = require("path");

module.exports = {
  entry: {
    app: "./src/app.js",
    main: "./src/main.js",
  },
  output:{
    path: path.resolve(__dirname,"dist"),
    filename: "[name].js",  // webpack命名方式，[name]以文件名自己命名
  },
  plugins:[
    new HtmlWebpackPlugin({
      template: path.resolve(__dirname,'./public/test.html'),
    }),
  ],
  mode: "production",
  optimization:{
    splitChunks:{
      chunks:"all",
      cacheGroups:{
        default:{
          minSize: 0,
          // minChunks: 2,
          // priority: -20,
          // reuseExistingChunk:true,
        }
      }
    }
  }
}